# coding=utf-8
# Date: 2021/9/16 10:03
from typing import List


# 执行用时：36 ms, 在所有 Python3 提交中击败了45.68%的用户
# 内存消耗：15 MB, 在所有 Python3 提交中击败了54.49%的用户
class Solution:
    def findWords(self, words: List[str]) -> List[str]:
        line = ["qwertyuiop", "asdfghjkl", "zxcvbnm"]
        hash = {}
        for i in range(3):
            for c in line[i]:
                hash[c] = i

        res = []
        for word in words:
            S = set()
            for c in word:
                S.add(hash[c.lower()])
            if len(S) == 1:
                res.append(word)
        return res


if __name__ == "__main__":
    print(Solution().findWords(["Hello", "Alaska", "Dad", "Peace"]))
